﻿<%@ page import="com.cai.entity.User" %>
<%@ page import="java.util.List" %>
<%@ page import="com.cai.dao.UserDao" %>
<%@ page import="com.cai.dao.impl.UserDaoImpl" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%
    UserDao userDao = new UserDaoImpl();
    List<User> list = userDao.userQueryAll();
    request.setAttribute("userList", list);
%>
<head>
    <title>回复消息</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <link href="style/adminStyle.css" rel="stylesheet" type="text/css"/>
    <script src="js/jquery.js"></script>
    <script src="js/public.js"></script>
</head>
<body>
<div class="wrap">
    <div class="page-title">
        <span class="modular fl"><i class="user"></i><em>回复消息</em></span>
    </div>
    <dl>
        <dt class="R-userTitle">发送者:${sessionScope.sendUser}</dt>
        <dd class="R-userCont">内容:${sessionScope.sendText}</dd>
        <dt class="R-userTitle">接收者:${sessionScope.user}</dt>
    </dl>
    <div>
        <textarea id="return_textarea" placeholder="请输入回复留言..." class="textarea block" style="padding:1em;"></textarea>
        <input type="button" value="回复留言 " class="tdBtn" style="margin:8px 0;"/>
    </div>
</div>
<script type="text/javascript">
    $(function () {
        $("input[type=button]").click(function () {
            $.ajax({
                url: "/cai/returnMessage",
                type: "post",
                data: {
                    "return_text": $("#return_textarea").val()
                },
                success: function (data) {
                    if (parseInt(data)===1){
                        //回复成功
                        alert("回复成功")
                        location.href="user_message.jsp";
                    }else {
                        //失败
                        alert("回复出错")
                    }
                }
            })
        })
    })
</script>
</body>
</html>